package com.sxhuayuan.parking.plugin.partnerpay.result;

import java.util.List;

import org.springframework.util.StringUtils;

import com.sxhuayuan.parking.config.Platform;

import lombok.Getter;
import lombok.Setter;

/**
 * 查询委托代扣用户状态
 * 
 * @author gy
 *
 */
@Getter
@Setter
public class QueryStateResult extends BaseResult {

	private String appid;
	
	private String subAppid;

	private Platform platform;

	private String userState;

	private String openid;

	private String subOpenid;

	private String path;

	private List<String> carPlates;

	public QueryStateResult(Platform platform) {
		super();
		this.platform = platform;
	}

	/**
	 * 是否需要用户进行签约
	 * 
	 * @return
	 */
	public Boolean isNeedToSign() {
		return !StringUtils.isEmpty(path);
	}

	/**
	 * 用户状态是否正常
	 * 
	 * @return
	 */
	public boolean isUserStateNormal() {
		switch (platform) {
		case weixin:
			return "NORMAL".equals(this.userState);
		case alipay:
			return "NORMAL".equals(this.userState);
		default:
			break;
		}
		return false;
	}

	/**
	 * 是否包含车牌号
	 * 
	 * @param carPlate
	 * @return
	 */
	public boolean isContainsCarPlate(String carPlate) {
		return this.carPlates.contains(carPlate);
	}
}